using System;

namespace CTCDecoder
{
    public class IDPair
    {
        public Guid GUID;
        public int  ID;

        public IDPair(Guid guid, int id)
        {
            this.GUID = guid;
            this.ID = id;
        }

        public IDPair()
        {
            this.GUID = Guid.Empty;
            this.ID = 0;
        }

        override public string ToString()
        {
            return String.Format("{0}:0x{1}", GUID.ToString("B"), ID.ToString("X"));
        }

        public static bool operator == (IDPair a, IDPair b)
        {
            if (Object.ReferenceEquals(a, b))
            {
                return true;
            }
            
            if ((object)a == null || (object)b == null)
            {
                return false;
            }

            return (a.GUID == b.GUID) && (a.ID == b.ID);
        }

        public static bool operator != (IDPair a, IDPair b)
        {
            return !(a == b);
        }

        public override bool Equals(object o)
        {
            if (!(o is IDPair))
            {
                return false;
            }

            IDPair other = o as IDPair;
            return this == other;
        }

        public override int GetHashCode()
        {
            return GUID.GetHashCode() + ID.GetHashCode();
        }


    };
}
